﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SmartParking.Migrations
{
    /// <inheritdoc />
    public partial class UpdateFieldName : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_SmartParkingPricingPlan_EffectiveDate_ExpiringDate",
                table: "SmartParkingPricingPlan");

            migrationBuilder.RenameColumn(
                name: "ExpiringDate",
                table: "SmartParkingPricingPlan",
                newName: "StartDate");

            migrationBuilder.RenameColumn(
                name: "EffectiveDate",
                table: "SmartParkingPricingPlan",
                newName: "EndDate");

            migrationBuilder.AddColumn<double>(
                name: "UpperLimit",
                table: "SmartParkingMultistepPrice",
                type: "float",
                nullable: false,
                defaultValue: 0.0);

            migrationBuilder.CreateIndex(
                name: "IX_SmartParkingPricingPlan_StartDate_EndDate",
                table: "SmartParkingPricingPlan",
                columns: new[] { "StartDate", "EndDate" },
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_SmartParkingPricingPlan_StartDate_EndDate",
                table: "SmartParkingPricingPlan");

            migrationBuilder.DropColumn(
                name: "UpperLimit",
                table: "SmartParkingMultistepPrice");

            migrationBuilder.RenameColumn(
                name: "StartDate",
                table: "SmartParkingPricingPlan",
                newName: "ExpiringDate");

            migrationBuilder.RenameColumn(
                name: "EndDate",
                table: "SmartParkingPricingPlan",
                newName: "EffectiveDate");

            migrationBuilder.CreateIndex(
                name: "IX_SmartParkingPricingPlan_EffectiveDate_ExpiringDate",
                table: "SmartParkingPricingPlan",
                columns: new[] { "EffectiveDate", "ExpiringDate" },
                unique: true);
        }
    }
}
